package com.boyunv.observer.example02;
/*
 *@description
 *
 *@author boyunv
 *@create 2023/8/9 21:42
 *@version 1.0
 */

public class Client {
 public static void main(String[] args) {
  GobangFactory instance = GobangFactory.getInstance();
  //获取3颗黑子
  GobangFlyweight b1 = instance.getGobang("b");
  GobangFlyweight b2 = instance.getGobang("b");
  GobangFlyweight b3 = instance.getGobang("b");
  System.out.println("判断是否是同一对象:"+(b1==b2));

  //获取3颗黑子
  GobangFlyweight w1 = instance.getGobang("w");
  GobangFlyweight w2 = instance.getGobang("w");
  GobangFlyweight w3 = instance.getGobang("w");
  System.out.println("判断是否是同一对象:"+(w1==w2));

  //显示棋子
  b1.display();
  b2.display();
  b3.display();
  w1.display();
  w2.display();
 }
}
